Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contract docker #2

Merged
merged 4 commits into from
Jul 11, 2024
Merged

Contract docker #2

merged 4 commits into from
Jul 11, 2024

Conversation

MSevey
Copy link
Contributor

@MSevey MSevey commented Jul 11, 2024

Overview

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

Summary by CodeRabbit

  • Chores
    • Introduced a new Docker build job for contract builds in the CI pipeline.
    • Implemented a multi-stage Docker build process for efficient contract compilation and deployment.

Copy link

coderabbitai bot commented Jul 11, 2024

Warning

Rate limit exceeded

@MSevey has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 7 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between cdb40ae and 15d2db9.

Walkthrough

This update introduces a new job, docker-build-contract, in the GitHub Actions workflow to streamline the Docker build and publication process. It employs a reusable Dockerfile pipeline for building with specific permissions, focusing on creating and optimizing a Rust-based contract. The Dockerfile.contract uses a multi-stage build process to efficiently compile the contract and create a smaller runtime image, ensuring an optimized deployment.

Changes

File/Path Change Summary
.github/workflows/docker-build-publish.yml Added a new job docker-build-contract for building Docker images with specific permissions.
Dockerfile.contract Introduced a multi-stage Docker build process for Rust contract compilation and optimized runtime image creation.

In Docker's depths, a contract grew,
Rusty code made fresh, anew.
Multi-stages, swift and lean,
Now in runtime, all pristine.
Through workflows, it did glide,
With CodeRabbit as its guide. 🐇🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Outside diff range, codebase verification and nitpick comments (3)
Dockerfile.contract (3)

2-2: Consider using a more recent Rust version.

The Dockerfile uses Rust 1.64, which might be outdated. Consider updating to the latest stable version for improved features and security patches.


5-12: Optimize the dependency installation process.

Combining apt-get update and apt-get install into a single RUN statement is good practice. However, using --no-install-recommends ensures minimal packages are installed, but you should ensure all required packages are explicitly listed.

RUN apt-get update && apt-get install -y --no-install-recommends \
	curl \
	git \
	bash \
	build-essential \
	libssl-dev \
	ca-certificates \
	&& apt-get clean && rm -rf /var/lib/apt/lists/*

27-27: Consider using a more recent Alpine version.

The Dockerfile uses Alpine 3.20, which might be outdated. Consider updating to the latest stable version for improved features and security patches.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d6f158f and a6c033e.

Files selected for processing (2)
  • .github/workflows/docker-build-publish.yml (1 hunks)
  • Dockerfile.contract (1 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/docker-build-publish.yml
Additional comments not posted (3)
Dockerfile.contract (3)

15-15: Ensure the wasm target is necessary.

Adding the wasm target is essential for compiling to WebAssembly. Ensure this target is necessary for the contract being compiled.


24-24: Ensure the cargo wasm command is appropriate.

The cargo wasm command compiles the contract to WebAssembly. Ensure this command is appropriate for the project and that it completes successfully.


33-33: Verify the contract copy path.

Ensure that the path /cw-contracts/contracts/nameservice is correct and that the contract is copied correctly from the builder stage.

Dockerfile.contract Show resolved Hide resolved
RUN rustup target add wasm32-unknown-unknown

# Clone the cw-contracts repository
RUN git clone https://github.com/InterWasm/cw-contracts
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider specifying a commit hash or tag for the repository clone.

Cloning the repository without specifying a commit hash or tag can lead to unpredictable builds if the repository changes. Consider specifying a commit hash or tag for reproducible builds.

RUN git clone https://github.com/InterWasm/cw-contracts && cd cw-contracts && git checkout <commit_hash_or_tag>

Committable suggestion was skipped due to low confidence.

Dockerfile.contract Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a6c033e and cdb40ae.

Files selected for processing (1)
  • .github/workflows/docker-build-publish.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/docker-build-publish.yml

@MSevey MSevey merged commit 7cb2b39 into main Jul 11, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant